<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>微圈操作日志</title>
    <script src="/jquery/jquery-3.2.1.min.js"></script>
    <script src="/layui/layui.js"></script>
    <link rel="stylesheet" href="/layui/css/layui.css">
    <!--
        其他样式的ztree
        <link rel="stylesheet" type="text/css" href="/ztree/css/zTreeStyle/zTreeStyle.css">
        <link rel="stylesheet" href="/ztree/css/awesomeStyle/awesome.css"/>
    -->
    <link rel="stylesheet" href="/ztree/css/metroStyle/metroStyle.css"/>
    <script type="text/javascript" src="/ztree/js/jquery.ztree.all.min.js"></script>
    <script type="text/javascript" src="/ztree/js/jquery.ztree.core.js"></script>
    <script type="text/javascript" src="/ztree/js/jquery.ztree.excheck.js"></script>
    <script type="text/javascript" src="/ztree/js/jquery.ztree.exedit.js"></script>

    <style>
        *{
            margin: 0;
            padding: 0;
        }
        .box{
            width: 100%;
            height: 1030px;
        }
        .list{
            width: 1650px;
            height: 50px;
            margin-left: 20px;
            background-color:rgb(243,243,243);
        }
        .list-left{
            width: 100px;
            height: 30px;
            margin-top: 10px;
            float: left;
        }
        .list-left-left{
            width: 10px;
            height: 30px;
            float: left;
            background: green;
        }
        .list-left-right{
            width: 90px;
            height: 30px;
            font-size: 14px;
            line-height: 30px;
            float: left;
            text-indent: 5px;
        }
        .list-right{
            float: right;
            margin-top: 5px;
            margin-right: 45px;
        }
        .query{
            width: 1650px;
            height: 100px;
            margin-top: 20px;
            margin-left: 20px;
        }
        .layui-col-md11{
            width: 100%;
        }
        .layui-card-header{
            background-color:rgb(243,243,243);
        }
        .query-top-right{
            float: right;
            margin-right: 30px;
        }
        .layui-form-label{
            width: 105px;
            padding-left: 90px;
        }
        .layui-form-item .layui-input-inline {
            float: left;
            width: 200px;
            margin-right: 10px;
        }
        .record{
            width: 1650px;
            height: 821px;
            margin-top: 40px;
            margin-left: 20px;
            background-color:rgb(243,243,243);
        }
        .import{
            margin-left: 870px;
        }
        #button_ids{
            display: none;
        }
        .record-left{
            width: 300px;
            float: left;
        }
        .record-right{
            width: 1650px;
            height: 700px;
            float: left;
        }
        .layui-table-cell {
            line-height: 47px;
            height: inherit;
        }
        .layui-table-cell>a{
            color:green;
        }
        .layui-table-fixed {
            position: absolute;
            left: 0px;
            top: 0px;
            z-index: 101;
        }
        #rMenu {
            width: 48px;
            height: 97px;
            display: none;
        }
        .rMenuspan{
            width: 68px;
            height: 21px;
            line-height: 21px;
            font-size: 10px;
            border: 1px silver solid;
            margin: 1px;
            padding: 2px 6px;
            background-color: #DFDFDF;
        }
        img{
            width: 100px;
            height: 116px;
        }
    </style>
</head>
<body>
<div class="box">
    <!--商品列表-->
    <div class="list">
        <div class="list-left">
            <div class="list-left-left"></div>
            <p class="list-left-right">微圈操作日志</p>
        </div>
        <div class="list-right">
            <div class="list-right-left layui-btn layui-icon layui-icon-refresh" id="refresh">&nbsp;刷新</div>
            <div class="list-right-right layui-btn layui-icon layui-icon-left" id="goBack">&nbsp;返回</div>
        </div>
    </div>
    <!--筛选查询-->
    <div class="layui-row query">
        <div class="layui-col-md11">
            <div class="layui-card headerCenter">
                <div class="layui-card-header backColor">
                    <i class="layui-icon">&#xe615;</i>
                    筛选查询
                </div>
                <div class="layui-card-body">
                    <form class="layui-form" lay-filter="layForm">
                        <div class="layui-form-item">
                            <label class="layui-form-label">管理名称：</label>
                            <div class="layui-input-inline">
                                <input type="text" name="account" required lay-verify="required" placeholder="请输入管理员名称" autocomplete="off" class="layui-input">
                            </div>

                            <label class="layui-form-label">操作类型：</label>
                            <div class="layui-input-inline">
                                <select lay-filter="type" name="type" >
                                    <option value="">请选择操作类型</option>
                                    <option value="1">查看</option>
                                    <option value="3">删除</option>
                                    <option value="5">搜索</option>
                                </select>
                            </div>

                            <label class="layui-form-label">操作时间：</label>
                            <div class="layui-input-inline">
                                <input type="text" placeholder="请选择操作时间" class="layui-input" name="createDate" id="createDate"/>
                            </div>

                            <span>
                                <button type="reset" class="layui-btn layui-btn-warm query-top-right">
                                    <i class="layui-icon layui-icon-refresh"></i> 重置
                                </button>
                                <div class="query-top-right layui-btn" onclick="search()"><i class="layui-icon layui-icon-search"></i>搜索</div>
                                <!-- layui自带的重置功能 -->
                            </span>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
    <!--数据列表-->
    <div class="record">
        <div class="record-right">
            <!--表-->
            <table id="demoTable" lay-filter="demoTable"></table>
        </div>
    </div>
    <!--表头样式-->
    <div id="button_ids">
        <i class="layui-icon layui-icon-align-left"></i> 操作数据列表
    </div>
    <!--表内操作-->
    <div id="btnOperation" style="display:none" >
<!--        <a alt="查看" title="查看"  lay-event="selectTable">查看</a>-->
        <a alt="删除" title="删除"  lay-event="deleteTable">删除</a>
    </div>
    <!-- 返回 -->
    <p id="title" style="display: none;">微圈操作日志</p>
</div>


<script>
    layui.use(['jquery','layer','table','form','upload',"laydate"],function(){
        var $=layui.jquery;
        var layer=layui.layer;
        var table=layui.table;
        var form=layui.form;
        var upload=layui.upload;
        var laydate=layui.laydate;
        getJsLog();
        function getJsLog(param){
            $.ajax({
                url:"/JsLog/getJsLogMicroCircle",
                data:param,
                type:'post',
                dataType:'json',
                success:function (data) {
                    demoTable(data.data);
                }
            });
        };
        laydate.render({
            elem:"#createDate",
            type:"datetime"
        });
        search = function search() {
            var param = form.val("layForm");
            getJsLog(param);

        }
        //返回
        $('#goBack').click(function () {
            var title = $('#title').text();
            var iframe = parent.$('.iframe');
            $.each(iframe,function (i,item) {
                if(title == $(item).attr('_href')){
                    parent.$('#beforeHref').val($(item).attr('_href'));
                    parent.beforeHref();
                    return;
                }
            });
        });

        //刷新
        $("#Refresh").click(function () {
            location.reload();
        });

        /*表格*/
        function demoTable(data){
            table.render({
                elem:'#demoTable',
                title:"操作日志列表",
                data:data,
                toolbar:'#button_ids',
                limit:10,
                width:1650,
                page:{
                    layout:['count','prev','page','next','limit','skip','refresh'],
                    limits:[10,20,30],
                    first:"首页",
                    last:"尾页",
                },
                cols:[[
                    {type:'checkbox'},
                    {field:"",title:"序号",align:'center',templet:function (data) {
                            return data.LAY_INDEX;
                        }},
                    {field:"type",title:"操作类型",align:'center',templet:function (data) {
                            if(data.type == "1"){
                                return "查看日志";
                            }else if(data.type == "3"){
                                return "删除日志";
                            }else if(data.type == "5"){
                                return "搜索日志";
                            }
                        }},
                    {field:"remark",title:"备注",align:'center'},
                    {field:"createDate",title:"操作时间",align:'center'},
                    {field:"account",title:"管理员账号",align:'center'},
                    {field:"logType",title:"操作日志类型",align:'center',templet:function (data) {
                           return "微圈";
                        }},

                     {field:'',title:"操作",align:'center',toolbar:"#btnOperation"}
                ]]
            });
            table.on("tool(demoTable)",function (obj) {
                if (obj.event == "deleteTable"){
                    layer.confirm('要删除当前一条操作日志吗?', {icon: 3, title:'提示'}, function(index){
                        $.ajax({
                            url:"/JsLog/deleteJsLogMicroCircle",
                            data:{"logId":obj.data.logId},
                            type:"post",
                            dataType:'json',
                            success:function (data) {
                                if (data.data == true) {
                                    layer.msg("删除成功");
                                    getJsLog();
                                }else{
                                    layer.msg("删除失败");
                                }
                            }
                        });
                        layer.close(index);
                    });

                }
            });

        }







        //现在时间
        function getTime(){
            var date=new Date();
            var year=date.getFullYear();
            var month=date.getMonth()+1;
            var day=date.getDate();
            var hour=date.getHours();
            var minute=date.getMinutes();
            var second=date.getSeconds();
            var dateStr = year+"-"+zeroFilling(month)+"-"+zeroFilling(day)+" "+zeroFilling(hour)+":"+zeroFilling(minute)+":"+zeroFilling(second);
            return dateStr;
        }
        function zeroFilling(data){
            if(data<10){
                data="0"+data;
            }
            return data;
        }
    })
</script>
</body>
</html>